package com.learn.generator;

import org.jasypt.encryption.StringEncryptor;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

@SpringBootTest
public class SpringBootGeneratorApplicationTests {

    @Resource
    private StringEncryptor stringEncryptor;


    @Test
    public void encrypt() {
        String encrypt = stringEncryptor.encrypt("im01");
        String monitorPwd = stringEncryptor.encrypt("im@12345");

        //UUID  加密后的内容：AkZs6tdmJojZe74vfIi5BRXbUvqkBiNQrn3RO22GeqW9sBjbNuIcNz+GdqkqJ8DQ
        System.out.println("im01：" + encrypt);
        System.out.println("im@12345：" + monitorPwd);
        // 解密
        String decrypt = stringEncryptor.decrypt(encrypt);
        String decryptPwd = stringEncryptor.decrypt(monitorPwd);
        System.out.println("解密后的内容：" + decrypt);
        System.out.println("解密后的内容：" + decryptPwd);
    }


}